package com.ljc.mapper;

import com.ljc.entity.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface VideoMapper {
    /**
     * 添加视频
     */
    Integer addVideos(Video video);

    /**
     * 批量添加标签
     */
    Integer batchAddVideoTags(List<VideoTag> videoTagList);

    /**
     * 获得视频的分页数
     */
    Integer pageCountVideos(Map<String, Object> params);

    /**
     * 查询视频信息
     */
    List<Video> pageListVideos(Map<String, Object> params);

    /**
     * 根据视频id查询视频
     */
    Video getVideoById(Long id);

    /**
     * 查询当前视频是否被当前用户点赞过
     */
    VideoLike getVideoLikeByVideoIdAndUserId(@Param("videoId") Long videoId, @Param("userId") Long userId);

    /**
     * 新增一条点赞记录
     */
    void addVideoLike(VideoLike videoLike);

    /**
     * 取消点赞视频
     */
    void deleteVideoLike(@Param("videoId") Long videoId, @Param("userId") Long userId);

    /**
     * 查询视频点赞数量
     */
    Long getVideoLikes(Long videoId);

    Integer deleteVideoCollection(@Param("videoId") Long videoId, @Param("userId") Long userId);

    Integer addVideoCollection(VideoCollection videoCollection);

    Long getVideoCollections(Long videoId);

    VideoCollection getVideoCollectionByVideoIdAndUserId(@Param("videoId") Long videoId, @Param("userId") Long userId);

    VideoCoin getVideoCoinByVideoIdAndUserId(@Param("videoId") Long videoId, @Param("userId") Long userId);

    Integer addVideoCoin(VideoCoin videoCoin);

    Integer updateVideoCoin(VideoCoin videoCoin);

    Long getVideoCoinsAmount(Long videoId);

    Integer addVideoComment(VideoComment videoComment);

    Integer pageCountVideoComments(Map<String, Object> params);

    List<VideoComment> pageListVideoComments(Map<String, Object> params);

    List<VideoComment> batchGetVideoCommentsByRootIds(@Param("rootIdList") List<Long> rootIdList);

    Video getVideoDetails(Long videoId);

    Integer addVideoView(VideoView videoView);

    Integer getVideoViewCounts(Long videoId);

    VideoView getVideoView(Map<String, Object> params);

    List<UserPreference> getAllUserPreference();

    List<Video> batchGetVideosByIds(@Param("idList") List<Long> idList);

    List<VideoTag> getVideoTagsByVideoId(Long videoId);

    Integer deleteVideoTags(@Param("tagIdList") List<Long> tagIdList, @Param("videoId") Long videoId);

}
